/*
 * @Descripttion:
 * @version:
 * @Author: 淏
 * @Date: 2023-11-18 11:29:00
 * @LastEditors: 淏
 * @LastEditTime: 2024-04-30 15:34:57
 */
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: localStorage.token,
    name: localStorage.name,
    id: localStorage.id,
    level: localStorage.level,
    userName: localStorage.userName,
    passwd: localStorage.passwd,
  },
  getters: {},
  mutations: {
    set_token(state, token) {
      state.token = token
      localStorage.token = token
    },
    set_name(state, name) {
      state.name = name
      localStorage.name = name
    },
    set_id(state, id) {
      state.id = id
      localStorage.id = id
    },
    set_level(state, level) {
      state.level = level
      localStorage.level = level
    },
    set_userName(state, userName) {
      state.userName = userName
      localStorage.userName = userName
    },
    set_passwd(state, passwd) {
      state.passwd = passwd
      localStorage.passwd = passwd
    },
  },
  actions: {},
  modules: {},
})
